package com.yq.cp.utils.wechat.model;


import com.yq.cp.config.MyException;
import com.yq.cp.utils.StringUtil;
import lombok.Data;

import java.io.Serializable;

@Data
public class WeChatPayParam implements Serializable {

    private static final long serialVersionUID = 3074865242765331794L;

    private String type;
    private String tradeNo;
    private String totalFee;
    private String body;
    private String ip;
    private String openId;

    public String getType() {
        if (StringUtil.isEmpty(type)) {
            throw new MyException("Type can't be null");
        }
        return type;
    }

    public String getTradeNo() {
        if (StringUtil.isEmpty(tradeNo)) {
            throw new MyException("TradeNo can't be null");
        }
        return tradeNo;
    }

    public String getTotalFee() {
        if (StringUtil.isEmpty(totalFee)) {
            throw new MyException("TotalFee can't be null");
        }
        return totalFee;
    }

    public String getBody() {
        if (StringUtil.isEmpty(body)) {
            throw new MyException("Body can't be null");
        }
        return body;
    }

    public WeChatPayParam setType(String type) {
        this.type = type;
        return this;
    }

    public WeChatPayParam setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
        return this;
    }

    public WeChatPayParam setTotalFee(String totalFee) {
        this.totalFee = totalFee;
        return this;
    }

    public WeChatPayParam setBody(String body) {
        this.body = body;
        return this;
    }

    public WeChatPayParam setIp(String ip) {
        this.ip = ip;
        return this;
    }

    public WeChatPayParam setOpenId(String openId) {
        this.openId = openId;
        return this;
    }

    public static WeChatPayParam builder() {
        return new WeChatPayParam();
    }

}
